package com.yzt.minemodule.wallet.adapter;

import android.text.TextUtils;

import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.yzt.zhuju.network.entity.mine.wallet.WalletDetialList;
import com.yzt.minemodule.R;

import java.util.List;
/**
 * author : bob
 * date   : 2022/12/1
 * desc   : 资金列表
 */
public class WalletDetialListAdapter extends BaseMultiItemQuickAdapter<WalletDetialList, BaseViewHolder> implements LoadMoreModule {

    public WalletDetialListAdapter(List data) {
        super(data);
//        addItemType(WalletDetialList.TYPE_HEADER, R.layout.layout_sticky_header_view);
        addItemType(WalletDetialList.TYPE_CONTENT, R.layout.item_wallet_detial_list);
    }

    @Override
    protected void convert(BaseViewHolder holder, WalletDetialList item) {
        switch (holder.getItemViewType()) {
//            case WalletDetialList.TYPE_HEADER:
//                holder.setText(R.id.first_letter_tv, item.getRecordDay());
//                holder.setText(R.id.detail_tv, item.getMessage());
//                break;
            case WalletDetialList.TYPE_CONTENT:
                holder.setText(R.id.title_tv, item.getItem());
                holder.setText(R.id.time_tv, item.getRecordTime());
                holder.setText(R.id.money_detail_tv, item.getAmount());
                if (TextUtils.equals(item.getType(), "income")) {
                    holder.setTextColor(R.id.money_detail_tv, ContextCompat.getColor(getContext(),R.color.color_ff3c00));
                } else {
                    holder.setTextColor(R.id.money_detail_tv, ContextCompat.getColor(getContext(),R.color.color_262628));
                }
                break;
            default:
                break;
        }
        holder.itemView.setTag(holder.getItemViewType());
        holder.itemView.setContentDescription(item.getRecordDay() + "#" + item.getMessage());
    }
}
